package cn.itcast.mapper.impl;

import cn.itcast.mapper.UserDao;
import cn.itcast.domain.Category;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public class UserDaoImpl implements UserDao {
    @Autowired
    private JdbcTemplate jt;

    public List<Category> findAll() {
        String sql="select * from tab_category";
        return jt.query(sql,new BeanPropertyRowMapper<>(Category.class));
    }
}
